package com.itheima.demo03;

//动物类, 父类.
public class Animal {
    //属性, 成员变量
    //姓名
    private String name;
    //年龄
    private int age;

    //空参, 全参.
    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //getXxx(), setXxx()
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //行为, 成员方法
    //吃饭
    public void eat() {
        System.out.println("动物要吃饭!");
    }

    public void run() {
        System.out.println("动物会跑步！");
    }
}
